<template>
    <h2>用户登录</h2>
    <table>
        <tr>
            <td>用户名：</td>
            <td>
                <input type="text" v-model="UserName">
            </td>
        </tr>
        <tr>
            <td>用户密码：</td>
            <td>
                <input type="text" v-model="Password">
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="button" value="登录" @click="deng" />
            </td>
        </tr>
    </table>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import axios from 'axios';
import { useRouter } from 'vue-router';
const UserName = ref('');
const Password = ref('');
const router = useRouter();
const deng = () => {
    axios.get("http://localhost:49765/api/Jie/ShowLogin", {
        params: {
            name: UserName.value,
            pwd: Password.value
        }
    })
        .then(res => {
            if (res.data != null) {
                alert("登录成功");
                return;
            }
            else {
                alert("登录失败");
                return;
            }
        })
}
</script>